package com.fishing.util;

/**
 * 给发送道具，改变中文名称插入数据库
 * @author lrz
 */
public class ChangePropName {
    
	public static void main(String[] args) {
		StringBuilder sb = new StringBuilder();
		sb.append("[[1,10,10000000],[1,11,30000000],[1,12,50000000]]");
		StringBuilder sb1 = new StringBuilder();
		String end = sb.toString(); //找定 ] 前面的数字
		
		char[] s = sb.toString().toCharArray();
        for(int i = 0;i < s.length;i++) {
        	String value = "";//给中间value设置
        	if(s[i] <= '9' && s[i] >= '0') {
        		String idx1 = String.valueOf(s[i]); //char变string
        		i = end.indexOf(",",i) + 1;
        		int findmid = end.indexOf(",", i);
        		for(int m = i;m <= findmid - 1; m++) {
        			    value = value + String.valueOf(s[m]);
        		}
        		String idx2 = value;
        		value = "";
        		i = end.indexOf(",",i) + 1;
        		//System.out.println(i);
        		//System.out.println(end.charAt(i));
        		int find = end.indexOf("]", i);
        		for(int j = i;j <= find - 1; j++) {
        			    value = value + String.valueOf(s[j]);
        		}
        		sb1.append(StringMatch(idx1,idx2,value));
        		i = i + value.length();
        	}
        }
        System.out.println(sb1.toString());
	}
    public static String PropSplice(StringBuilder sb) {
    	//StringBuilder sb = new StringBuilder();//追加道具
		/*StringBuilder sb1 = new StringBuilder();//追加道具名称
		String end = sb.toString();
		char[] s = sb.toString().toCharArray();
        for(int i = 0;i < s.length;i++) {
        	if(s[i] <= '9' && s[i] >= '0') {
        		//System.out.println(i); 看i有没有成功到自己想要的位置
        		String idx1 = String.valueOf(s[i]); //char变string
        		i = i + end.indexOf(",",i) + 1;
        		String idx2 = String.valueOf(s[i]);
        		i = i + end.indexOf(",",i) + 1;
        		//String value = String.valueOf(s[i]);
        		String value = "";
        			int find = end.indexOf("]", i);
            		for(int j = i;j <= find - 1; j++) {
            			    value = value + String.valueOf(s[j]);
            		}
        		sb1.append(StringMatch(idx1,idx2,value));
        		i = i + 3;
        	}
        }
    	return sb1.toString();*/
  
		StringBuilder sb1 = new StringBuilder();
		String end = sb.toString(); //找定 ] 前面的数字
		char[] s = sb.toString().toCharArray();
        for(int i = 0;i < s.length;i++) {
        	String value = "";//给中间value设置
        	if(s[i] <= '9' && s[i] >= '0') {
        		String idx1 = String.valueOf(s[i]); //char变string
        		i = end.indexOf(",",i) + 1;
        		int findmid = end.indexOf(",", i);
        		for(int m = i;m <= findmid - 1; m++) {
        			    value = value + String.valueOf(s[m]);
        		}
        		String idx2 = value;
        		value = "";
        		i = end.indexOf(",",i) + 1;
        		//System.out.println(i);
        		//System.out.println(end.charAt(i));
        		int find = end.indexOf("]", i);
        		for(int j = i;j <= find - 1; j++) {
        			    value = value + String.valueOf(s[j]);
        		}
        		sb1.append(StringMatch(idx1,idx2,value));
        		i = i + value.length();
        	}
        }
        return sb1.toString();
    }
    
    public static StringBuilder StringMatch(String idx1,String idx2,String value) {
    	StringBuilder sb = new StringBuilder();
    	if(idx1.equals("1") && idx2.equals("1")) {
    		String name1 = "[锁定,";
    		sb.append(name1);
    		sb.append(value);
    		String name2 = "] ";
    		sb.append(name2);
    	}
    	if(idx1.equals("1") && idx2.equals("2")) {
    		String name1 = "[冰冻,";
    		sb.append(name1);
    		sb.append(value);
    		String name2 = "] ";
    		sb.append(name2);
    	}
    	if(idx1.equals("1") && idx2.equals("3")) {
    		String name1 = "[召唤葫芦,";
    		sb.append(name1);
    		sb.append(value);
    		String name2 = "] ";
    		sb.append(name2);
    	}
    	if(idx1.equals("1") && idx2.equals("4")) {
    		String name1 = "[狂暴卡,";
    		sb.append(name1);
    		sb.append(value);
    		String name2 = "] ";
    		sb.append(name2);
    	}
    	if(idx1.equals("1") && idx2.equals("5")) {
    		String name1 = "[分身卡,";
    		sb.append(name1);
    		sb.append(value);
    		String name2 = "] ";
    		sb.append(name2);
    	}
    	if(idx1.equals("1") && idx2.equals("6")) {
    		String name1 = "[青铜弹头,";
    		sb.append(name1);
    		sb.append(value);
    		String name2 = "] ";
    		sb.append(name2);
    	}
    	if(idx1.equals("1") && idx2.equals("7")) {
    		String name1 = "[白银弹头,";
    		sb.append(name1);
    		sb.append(value);
    		String name2 = "] ";
    		sb.append(name2);
    	}
    	if(idx1.equals("1") && idx2.equals("8")) {
    		String name1 = "[黄金弹头,";
    		sb.append(name1);
    		sb.append(value);
    		String name2 = "] ";
    		sb.append(name2);
    	}
    	if(idx1.equals("1") && idx2.equals("9")) {
    		String name1 = "[紫金弹头,";
    		sb.append(name1);
    		sb.append(value);
    		String name2 = "] ";
    		sb.append(name2);
    	}
    	if(idx1.equals("1") && idx2.equals("10")) {
    		String name1 = "[防水木料,";
    		sb.append(name1);
    		sb.append(value);
    		String name2 = "] ";
    		sb.append(name2);
    	}
    	if(idx1.equals("1") && idx2.equals("11")) {
    		String name1 = "[精炼矿石,";
    		sb.append(name1);
    		sb.append(value);
    		String name2 = "] ";
    		sb.append(name2);
    	}
    	if(idx1.equals("1") && idx2.equals("12")) {
    		String name1 = "[海妖外壳,";
    		sb.append(name1);
    		sb.append(value);
    		String name2 = "] ";
    		sb.append(name2);
    	}
    	if(idx1.equals("1") && idx2.equals("13")) {
    		String name1 = "[潮汐精粹,";
    		sb.append(name1);
    		sb.append(value);
    		String name2 = "] ";
    		sb.append(name2);
    	}
    	if(idx1.equals("1") && idx2.equals("14")) {
    		String name1 = "[深海魔晶,";
    		sb.append(name1);
    		sb.append(value);
    		String name2 = "] ";
    		sb.append(name2);
    	}
    	if(idx1.equals("0") && idx2.equals("1")) {
    		String name1 = "[钻石,";
    		sb.append(name1);
    		sb.append(value);
    		String name2 = "] ";
    		sb.append(name2);
    	}
    	if(idx1.equals("0") && idx2.equals("2")) {
    		String name1 = "[金币,";
    		sb.append(name1);
    		sb.append(value);
    		String name2 = "] ";
    		sb.append(name2);
    	}
    	if(idx1.equals("0") && idx2.equals("100")) {
    		String name1 = "[Vip经验,";
    		sb.append(name1);
    		sb.append(value);
    		String name2 = "] ";
    		sb.append(name2);
    	}
    	if(idx1.equals("0") && idx2.equals("101")) {
    		String name1 = "[炮倍值,";
    		sb.append(name1);
    		sb.append(value);
    		String name2 = "] ";
    		sb.append(name2);
    	}
    	if(idx1.equals("1") && idx2.equals("16")) {
    		String name1 = "[号角,";
    		sb.append(name1);
    		sb.append(value);
    		String name2 = "] ";
    		sb.append(name2);
    	}
    	if(idx1.equals("1") && idx2.equals("17")) {
    		String name1 = "[超级号角,";
    		sb.append(name1);
    		sb.append(value);
    		String name2 = "] ";
    		sb.append(name2);
    	}
    	return sb;
    }
}
